package com.lmabbe.core.common.converter;

import com.lmabbe.core.common.dto.SysUserDTO;
import com.lmabbe.core.common.entitys.SysUser;
import com.lmabbe.core.common.vo.SysUserVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * 用户表 转换器
 *
 * @author lmabbe
 */
@Mapper(componentModel = "spring")
public interface SysUserConverter {

    /**
     * dto转实体
     *
     * @param to
     * @return
     */
    SysUser dto2Entity(SysUserDTO to);

    /**
     * dto转实体
     *
     * @param to
     * @return
     */
    @Mapping(target = "userId", source = "userId")
    SysUser dto2Entity(SysUserDTO to, Long userId);

    /**
     * 数据列表转Vo列表
     *
     * @param list
     * @return
     */
    List<SysUserVO> list2Vos(List<SysUser> list);

    /**
     * 实体转VO
     *
     * @param entity
     * @return
     */
    SysUserVO entity2Vo(SysUser entity);
}